package com.cskaoyan.service.wx;

import com.cskaoyan.bean.marketBean.MarketFeedback;
import com.cskaoyan.mapper.marketMapper.MarketFeedbackMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * 意见反馈模块
 * @author 曾添乐啦
 * @since 2023/01/01 21:57
 */
@Service
public class WxFeedBackServiceImpl implements WxFeedBackService{

    @Autowired
    MarketFeedbackMapper marketFeedbackMapper;

    /**
     * 后台意见反馈的响应数据
     * addTime: "2023-01-01 23:10:47"
     * content: "22"
     * deleted: false
     * feedType: "商品相关"
     * hasPicture: false
     * id: 46
     * mobile: "11111111111"
     * picUrls: []
     * status: 1
     * updateTime: "2023-01-01 23:10:47"
     * userId: 1
     * username: "user123"
     * 需要service层封装的数据如下
     *      *      addTime
     *      *      updateTime
     *      *      deleted         逻辑删除                       有默认值
     *      *      id              表中各行数据的id                有默认值
     *      *      status         状态                             有默认值
     * @param
     * @return
     */
    @Override
    public int insertFeedBack(MarketFeedback marketFeedback) {

        long currentTimeMillis = System.currentTimeMillis();
        Date date = new Date(currentTimeMillis);
        //向数据库中存放反馈用户的id和反馈时间
        marketFeedback.setAddTime(date);
        marketFeedback.setUpdateTime(date);
        marketFeedback.setStatus(0);
        int insertAffected = marketFeedbackMapper.insert(marketFeedback);
        return insertAffected;
    }
}
